<template>
  <div>
    <header class="header">
      <div class="project-name">{{ user.login }}</div>
      <div class="sub-name">欢迎来到{{ user.name }}的个人博客</div>
      <a :href="'https://github.com/' + user.login" class="btn" target="_blank"
        >GitHub主页</a
      >
      <a
        href="https://gitee.com/lanpang9661/lp-blog"
        class="btn"
        target="_blank"
        >博客源码</a
      >
    </header>
    <keep-alive>
      <topbar :user="user" />
    </keep-alive>

    <section class="main-content">
      <el-row>
        <el-col :span="6" style="padding-right: 10px">
          <sidebar></sidebar>
        </el-col>
        <el-col :span="18" style="padding-left: 10px">
          <app-main>
            <slot />
          </app-main>
        </el-col>
      </el-row>
    </section>
    <!-- 子组件出口 -->
    <!-- <slot /> -->
    <foot :user="user" />
  </div>
</template>

<static-query>
query {
  allUserInfo {
    edges {
      node {
        name
        html_url
        login
        avatar_url
        location
      }
    }
  }
}
</static-query>

<script>
import Foot from "./components/Foot";
import Topbar from "./components/Topbar";
import Sidebar from "./components/Sidebar";
import AppMain from "./components/AppMain";

export default {
  components: {
    Foot,
    Topbar,
    Sidebar,
    AppMain,
  },
  computed: {
    user() {
      return this.$static.allUserInfo.edges[0].node;
    },
  },
};
</script>

<style scoped>
.header {
  padding: 5rem 6rem;
  height: 12rem;
  color: rgb(38, 66, 78);
  text-align: center;
  background-color: #159957;
  background: url("../assets/imgs/bg.jpg") 0 -50px no-repeat;
  background-size: cover;
}
.project-name {
  font-size: 3.25rem;
}
.sub-name {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  margin-top: 0.5rem;
  opacity: 0.7;
}

.btn:hover {
  color: rgba(38, 66, 78, 0.8);
  text-decoration: none;
  background-color: rgba(38, 66, 78, 0.2);
  border-color: rgba(38, 66, 78, 0.3);
}

a:hover {
  text-decoration: underline;
}

a:active,
a:hover {
  outline: 0;
}

.btn {
  padding: 0.75rem 1rem;
  display: inline-block;
  margin: 0.5rem 1rem;
  color: rgba(38, 66, 78, 0.7);
  background-color: rgba(38, 66, 78, 0.08);
  border-color: rgba(38, 66, 78, 0.2);
  border-style: solid;
  border-width: 1px;
  border-radius: 0.3rem;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}

.main-content {
  max-width: 64rem;
  padding: 30px 0px 30px 0px;
  margin: 0 auto;
  font-size: 1.1rem;
  word-wrap: break-word;
  min-height: 800px;
}
</style>
